import requests
from fake_useragent import UserAgent

url = 'https://tieba.baidu.com/t/f/?class=college'

session = requests.Session()


headers = {
    'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
    'accept-encoding': 'gzip, deflate, br, zstd',
    'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
    'cache-control': 'max-age=0',
    'connection': 'keep-alive',
    'cookie': 'XFI=5dadbec0-b401-11f0-914b-b38b6df57e9b; XFCS=DD2AA59E081222F85ECA7BF090D5AEB2290F40D93F9C8310184081B19A8CB707; XFT=I4Un/4/FQoebRp0WEaaP8xLdlkouKe3yRVAxf7GQaew=; BAIDUID_BFESS=C0A0795FB0E3381E90A63EE563D6F905:FG=1; BIDUPSID=C0A0795FB0E3381E90A63EE563D6F905; PSTM=1751075079; ZFY=USx9HsDs9juDBQvlIdbC91IVsU76VC7nCdd5cMbDMJY:C; __bid_n=197f86f6baf028814bd0b5; BAIDU_WISE_UID=wapp_1755046438382_868; H_PS_PSSID=63146_64985_65248_65313_65361_65536_65605_65664_65739_65759_65780_65792_65853_65914_65919_65923_65939_65944_65962_65967_65989_65992; BDORZ=FFFB88E999055A3F8A630C64834BD6D0; H_WISE_SIDS=63146_64985_65248_65313_65361_65536_65605_65664_65739_65759_65780_65792_65853_65914_65919_65923_65939_65944_65962_65967_65989_65992; Hm_lvt_292b2e1608b0823c1cb6beef7243ef34=1761656738; HMACCOUNT=89C533DE0C63E95C; USER_JUMP=-1; ppfuid=FOCoIC3q5fKa8fgJnwzbE67EJ49BGJeplOzf+4l4EOvDuu2RXBRv6R3A1AZMa49I27C0gDDLrJyxcIIeAeEhD8JYsoLTpBiaCXhLqvzbzmvy3SeAW17tKgNq/Xx+RgOdb8TWCFe62MVrDTY6lMf2GrfqL8c87KLF2qFER3obJGmVXQmqM6seEAgB/LlOs0+zGEimjy3MrXEpSuItnI4KDwxAMUTOS16BfoX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; BDUSS=hKdjFhOFQ5cnpMREpTTi1HV3FPVXRsVmJZdDZScEpZUXJTckhETG5WSjRUaWhwRVFBQUFBJCQAAAAAAQAAAAEAAAAnVMN5aWlpb29vUTEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHjBAGl4wQBpNG; BDUSS_BFESS=hKdjFhOFQ5cnpMREpTTi1HV3FPVXRsVmJZdDZScEpZUXJTckhETG5WSjRUaWhwRVFBQUFBJCQAAAAAAQAAAAEAAAAnVMN5aWlpb29vUTEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHjBAGl4wQBpNG; STOKEN=b7e0f1461af9832c0e11002ad19f5d57a9e8e5aa3cd84c63009a58ce157497f9; st_key_id=17; arialoadData=false; tshow_out_hide=1; BA_HECTOR=0k018l0hal800gaha4ak0l0l2525801kg1gf825; XFI=2b507c20-b400-11f0-80e3-b3966344cc6f; ariaappid=c890648bf4dd00d05eb9751dd0548c30; ariauseGraymode=false; ab_sr=1.0.1_MzcwOWI2ODI2NjI2ZTAwNDZmZGQ1NmZmODFjYTc0YjFjNjc3ZjFjMWZiNTU3Njk5NmI5ZTY4YjAzMTExY2UyNmJlZGU4YzljYjE3Y2U3MDhiNWNmY2QxNWQ0YjhiYWFkZTRiNmE4MDU5MDU3ZTY1MGM1Yzg2OWQzOWM2YjA5NGYyMmU0ODdmMThjZWM2OWMyYzE0YmJiYjgzMTg0MTFjYjA0NjYxOWY5MjhkMzI5MjFhOGIwMjI5ZjBmMDYzNjI3; st_data=d536065e2228b5b4c1fd88d2052726d6e86ba90f74e10ddc4cda5072dcddbd23dde0a439e3fa0415d06b407ffce6741233104f0f6a545900aff311818238e6206223c4a8bb9b11f0a9f8ef6023307db31f07825c5e097d5cc12c8a2e54f344c5c75f54232c38e607e154867dee726aaf8dfa4769f9b299c1cbfa109b8cd6b47ab7460784a3fcac5c335819e94bb4ad19; st_sign=3dd3eaf1; XFCS=4F9FDD3B03604FE83226AA9621216894AB0544374505B608CA573676517D1279; XFT=l+cZrBR7dmYtRgQaeFpoffYqogOl9evdPmtLWphmQPw=; RT="z=1&dm=baidu.com&si=d89405ba-60db-4e4e-9c54-05c58ce26e95&ss=mhallazy&sl=1&tt=mf&bcn=https%3A%2F%2Ffclog.baidu.com%2Flog%2Fweirwood%3Ftype%3Dperf&ld=1vy&ul=22a&hd=236"; Hm_lpvt_292b2e1608b0823c1cb6beef7243ef34=1761657841',
    'host': 'tieba.baidu.com',
    'sec-ch-ua': '"Microsoft Edge";v="141", "Not?A_Brand";v="8", "Chromium";v="141"',
    'sec-ch-ua-mobile': '?0',
    'sec-ch-ua-platform': '"Windows"',
    'sec-fetch-dest': 'document',
    'sec-fetch-mode': 'navigate',

    'sec-fetch-site': 'none',
    'sec-fetch-user': '?1',
    'upgrade-insecure-requests': '1',
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36 Edg/141.0.0.0'
}
session.headers.update(headers)
response = session.get(url)
print(response.status_code)
print(response.text)





